<!--父级组件-->
<template>
  <h2>父级组件,setup的细节</h2>
  <h3>msg:{{msg}}</h3>
  <button @click="msg+='==='">更新数据</button>
  <Child :msg="msg" msg5="测试" @updateMsg="updateMsg2" />
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
import Child from './Child.vue'
export default defineComponent({
  name: 'SetupDemo',
  // 注册组件
  components: {
    Child
  },
  setup() {
    // 普通类型的响应式数据
    const msg = ref('what are you no sha lei')
    // 永爱更新普通数据
    const updateMsg2 = (txt:string) => {
      msg.value += txt
    }
    return {
      msg,
      updateMsg2
    }
  }
})
</script>
